// pages/my/my_userFeelBack/index.js
const userBackPage=require("../../controllers/ControllerX").controller.userBackPage;

const app=getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userFeel:[]
  },

  onLoad: function (options) {
    this.getUserFeel();

  },

  onReachBottom: function () {
    if(this.data.lastPage)return 
    this.getUserFeel(false)
  },

  //获取用户反馈

  getUserFeel(isFirst = true){
    if(isFirst){
      this.setData({
        pageNumber:1,
      })
    }
    let pageNumber = this.data.pageNumber
    let value={
      pageNumber,
      pageSize:20,
      shopId:wx.getStorageSync('shopId')
    }
    userBackPage(value).then(res=>{
      let list=res.data.list;
      for(let i=0;i<list.length;i++){
        if(list[i].imgList!=false){
          for(let j=0;j<list[i].imgList.length;j++){
            list[i].imgList[j].image=list[i].imgList[j].image.split("=")[1]
          }
        }
      }
      pageNumber+=1
      let userFeel = this.data.userFeel
      userFeel = userFeel.concat(list)
      this.setData({
        userFeel,
        pageNumber,
        lastPage:res.data.lastPage
      })
      console.log(this.data.userFeel)
    })
  }
})